if SERVER then

/* Server DataStream object */
DS = {}

/* Send team information to a player */
DS.SendTeamInfo = function( ply, tmObj )

	/* Validate player */
	if not player.IsValid( ply ) then
		DEBUG:ErrMsg( "Invalid player: " .. tostring( ply ), "DS.SendTeamInfo" )
		return false
	end
	
	/* Get the team object */
	local tm		= team.GetInfo( tmObj )
	if not tm then
		DEBUG:ErrMsg( "Invalid team identifier: " .. tostring( tmObj ), "DS.SendTeamInfo" )
		return false
	end
	
	/* Debug output */
	DEBUG:Msg( "Sending team information: " .. tostring( tm.ChatName ), "DS.TeamInfoSent" )
	
	/* Send info */
	datastream.StreamToClients( ply, "DS.GetTeamInfo", tm, DS.TeamInfoSent )
end

/* Callback - team info has been sent */
DS.TeamInfoSent = function()

	/* Debug output */
	DEBUG:Msg( "Team information successfully sent", "DS.TeamInfoSent" )
end

end